import request from '@/utils/request'

/**
 * 获取权限树
 */
export function getPermissionTree() {
  return request({
    url: '/permission/tree',
    method: 'get'
  })
}

/**
 * 获取所有权限
 */
export function getPermissionList() {
  return request({
    url: '/permission/list',
    method: 'get'
  })
}

/**
 * 获取权限详情
 */
export function getPermissionDetail(id) {
  return request({
    url: `/permission/${id}`,
    method: 'get'
  })
}

/**
 * 新增权限
 */
export function addPermission(data) {
  return request({
    url: '/permission',
    method: 'post',
    data
  })
}

/**
 * 更新权限
 */
export function updatePermission(data) {
  return request({
    url: '/permission',
    method: 'put',
    data
  })
}

/**
 * 删除权限
 */
export function deletePermission(id) {
  return request({
    url: `/permission/${id}`,
    method: 'delete'
  })
}
